/**
 * 
 */
package com.onewingu.gcs.server;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gdata.client.appsforyourdomain.UserService;
import com.google.gdata.client.contacts.ContactsService;
import com.google.gdata.data.Link;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.appsforyourdomain.provisioning.UserEntry;
import com.google.gdata.data.appsforyourdomain.provisioning.UserFeed;
import com.google.gdata.data.contacts.ContactEntry;
import com.google.gdata.data.contacts.ContactFeed;
import com.google.gdata.data.contacts.ContactGroupEntry;
import com.google.gdata.data.contacts.ContactGroupFeed;
import com.google.gdata.data.contacts.GroupMembershipInfo;
import com.google.gdata.util.AuthenticationException;

/**
 * @author er66
 *
 */
@SuppressWarnings("serial")
public class Sync extends HttpServlet {
	//cs = contact share
	//public static final String PREFIX = "CS-";

	public static final String SOURCE_ACCT_EMAIL = "erin.reddick@freedomreg.com";

	public static final String APP_NAME = "Contact Share";

	public static final String APPS_FEEDS_URL_BASE = "https://apps-apis.google.com/a/feeds/";

	public static final String SERVICE_VERSION = "2.0";

	public static final String DOMAIN = "freedomreg.com";

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
	throws ServletException, IOException {
		PrintWriter writer = resp.getWriter();
		PersistenceManager pm = PMF.get().getPersistenceManager();
		
		try {
			new Sync2(pm).sync();
		} catch(Exception e) {
			writer.print("sync exception: " + e.getMessage());
		} finally {
			pm.close();
		}
	}
}
